﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace t_205_verk_hopur_12
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
               "DeleteVideo",
               "Channel/DeleteVideo/{id}/{videoID}",
               new { controller = "Channel", action = "DeleteVideo", id = UrlParameter.Optional, videoID = UrlParameter.Optional }
           );

            routes.MapRoute(
               "VideoDetails",
               "Channel/VideoDetails/{id}/{videoID}",
               new { controller = "Channel", action = "VideoDetails", id = UrlParameter.Optional, videoID = UrlParameter.Optional }
           );

            routes.MapRoute(
                "EditVideo",
                "Channel/EditVideo/{channelID}/{videoID}",
                new { controller = "Channel", action = "EditVideo", channelID = UrlParameter.Optional, videoID = UrlParameter.Optional }
            );

            routes.MapRoute(
               "ElectionEnd",
               "Channel/ElectionEnd/{id}/{videoID}",
               new { controller = "Channel", action = "ElectionEnd", id = UrlParameter.Optional, videoID = UrlParameter.Optional }
           );

            routes.MapRoute(
                "ElectionCreate",
                "Channel/ElectionCreate/{id}/{videoID}",
                new { controller = "Channel", action = "ElectionCreate", id = UrlParameter.Optional, videoID = UrlParameter.Optional }     
            );

            routes.MapRoute(
                "EditSchedule",
                "Channel/EditSchedule/{channelID}/{day}/{scheduleID}",
                new { controller = "Channel", action = "EditSchedule", channelID = UrlParameter.Optional, day = UrlParameter.Optional, scheduleID = UrlParameter.Optional }
            );

            routes.MapRoute(
                "Schedule",
                "Channel/Schedule/{id}/{day}",
                new { controller = "Channel", action = "Schedule", id = UrlParameter.Optional, day = UrlParameter.Optional }
            );

            routes.MapRoute(
                "VideoView",
                "Channel/Index/{id}/{scheduleID}",
                new { controller = "Channel", action = "Index", id = UrlParameter.Optional, scheduleID = UrlParameter.Optional }
            );

            routes.MapRoute(
                "DeleteSchedule",
                "Channel/DeleteSchedule/{id}/{scheduleID}/{day}",
                new { controller = "Channel", action = "DeleteSchedule", id = UrlParameter.Optional, scheduleID = UrlParameter.Optional, day = UrlParameter.Optional }
            );

            routes.MapRoute(
                "RemoveApplication",
                "Channel/RemoveApplication/{id}/{userID}",
                new { controller = "Channel", action = "RemoveApplication", id = UrlParameter.Optional, userID = UrlParameter.Optional }
            );
            routes.MapRoute(
                "HireEmployee",
                "Channel/HireEmployee/{id}/{userID}",
                new { controller = "Channel", action = "HireEmployee", id = UrlParameter.Optional, userID = UrlParameter.Optional }
            );

            routes.MapRoute(
                "NoticeEdit",
                "Channel/NoticeEdit/{channelID}/{noteID}",
                new { controller = "Channel", action = "NoticeEdit", channelID = UrlParameter.Optional, noteID = UrlParameter.Optional }
            );

            routes.MapRoute(
                "Search",
                "Channel/Search/",
                new { controller = "Channel", action = "Search" }
            );

            routes.MapRoute(
                "VoteVideo",
                "Channel/VoteVideo/{videoID}/{vote}",
                new { controller = "Channel", action = "VoteVideo", videoID = UrlParameter.Optional, vote = UrlParameter.Optional }
            );
  
            // Fyrir channel votes
            routes.MapRoute(
                "VoteChannel",
                "Channel/VoteChannel/{channelID}/{vote}",
                new { controller = "Channel", action = "VoteChannel", channelID = UrlParameter.Optional, vote = UrlParameter.Optional }
            );

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}